package com.itheima.controller;

import com.itheima.domain.mongo.Sound;
import com.itheima.service.mongo.SoundService;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sound")
public class SoundController{

    @Autowired
    private SoundService soundService;

    //发送保存语音
    @PostMapping("/save")
    public void save(Sound sound) {
        soundService.save(sound);
    }

    //接收查找语音
    @GetMapping("/findByGender")
    public Sound findByGender(String gender) {
        return soundService.findByGender(gender);
    }


    //根据语音id删除
    @GetMapping("/soundDeleteById")
    public void soundDeleteById(ObjectId id) {
        soundService.soundDeleteById(id);
    }
}
